package com.ncu.gulimall.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ncu.gulimall.common.to.mq.SeckillOrderTo;
import com.ncu.gulimall.common.utils.PageUtils;
import com.ncu.gulimall.order.entity.OrderEntity;
import com.ncu.gulimall.order.vo.OrderConfirmVo;
import com.ncu.gulimall.order.vo.OrderSubmitVo;
import com.ncu.gulimall.order.vo.PayAsyncVo;
import com.ncu.gulimall.order.vo.PayVo;
import com.ncu.gulimall.order.vo.SubmitOrderRespVo;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author giraffe
 * @email giraffe@gmail.com
 * @date 2020-04-28 16:33:47
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 订单确认页返回需要的数据
     * @return
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 下单
     * @param vo
     * @return
     */
    SubmitOrderRespVo submitOrder(OrderSubmitVo vo);

    OrderEntity getOrderByOrderSn(String orderSn);

    void closeOrder(OrderEntity orderEntity);

    /**
     * 获取当前订单的支付信息
     * @param orderSn
     * @return
     */
    PayVo getOrderPay(String orderSn);

    /**
     * 分页查询当前登陆用户的订单信息
     * @param params
     * @return
     */
    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     * 处理支付宝的支付结果
     * @param vo
     * @return
     */
    String handlePayResult(PayAsyncVo vo);

    void createSeckillOrder(SeckillOrderTo seckillOrderTo);
}

